<?php 
/**
 * Joomla! 1.5 component arts_curriculum $Id: view.feed.php
 * @package    arts_curriculum
 * @version		
 * @subpackage
 * @author     Chris Borkowski {@link http://www.guggenheim.org}
 * @author     Created on o6-August-2010
 * @author     Modified on 06-December-2010
 */
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.view');

/**
* RSS FEED View class for the arts_curriculum component
* @package Arts_curriculum
*/

class Arts_curriculumViewCategories extends JView

{
	function display()
	{
		global $mainframe;

		$document =& JFactory::getDocument();
		$params =& $mainframe->getParams();
		$feedEmail = (@$mainframe->getCfg('feed_email')) ? $mainframe->getCfg('feed_email') : 'author';
		$siteEmail = $mainframe->getCfg('mailfrom');

		// Get me the sites Global feed limit if it has one - we won't use it here - but maybe later
		JRequest::setVar('limit', $mainframe->getCfg('feed_limit'));
		
		// Get some data from the model
		$categories =& $this->get('data');
	 	//this has a little of bit of data we need
		$intro =& $this->get('intro');
		
		$document->setTitle('Arts Curriculum Online');
	
		//do a lot of prep work	
		//strip this out
		$tags = array('Resources for Teachers','More');
		$description = strip_tags(html_entity_decode(str_replace( $tags, '', $this->escape($intro[0]->main_body))));
		$document->setDescription($description);
		
		//we ontly want 7 of these otherwise use "count($categories);" if we want them all
		for($i = 0; $i < 7; $i++)
		{
		$category =& $categories[$i];

		$item = new JFeedItem();
 		$item->title 		= 'Exhibiton: '. $this->escape($category->title);
 		$item->link 		= JRoute::_('index.php?option=com_arts_curriculum&view=category&id='. $category->slug);
 		$item->description  =  '<img src="images/stories/'.$category->image.'"><br>'; 
 		$item->description .= preg_replace('/{ac-break}(.*)|(\n)(.*){1,}/', '', $category->description);
		
		//wrap it up and push it out the door
		$document->addItem( $item );
		
		}//end for

	}//end function

}//end class
